<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定时器</title>
</head>
<body>
    <script>
        //下面是封装的timeout函数，使用定时器会更加方便
        // function timeout(times){
        //     return new Promise(resolve => {
        //         setTimeout(resolve,times);
        //     });
        // }
        // timeout(3000).then(() => {
        //     console.log('三秒后执行');
        //     return timeout(3000);
        // }).then(() => {
        //     console.log("执行上一步的promise后一秒执行");
        // });

        
    </script>
</body>
</html>